package com.han.observer.jdk_observer;

/**
 * @ClassName Client
 * @Description 描述该类的功能
 * @Author duoduo Han
 * @Date 2024/6/17 13:25
 */
public class Client {
    public static void main(String[] args) {
        //创建股票对象
        Stock stock = new Stock("Bilibili:1000");
        //创建观察者对象
        Board board = new Board();
        Phone phone = new Phone();
        Pad pad = new Pad();
        //观察者观测股票
        stock.addObserver(board);
        stock.addObserver(phone);
        stock.addObserver(pad);
        //更新股票对象
        stock.changeData("Bilibili:2000");
        System.out.println("===========更新============");
        stock.changeData("Bilibili:3000");
        System.out.println("===========更新============");
        stock.changeData("Bilibili:3500");
        System.out.println("===========更新============");
        stock.changeData("Bilibili:3800");
        System.out.println("===========更新============");
        stock.changeData("Bilibili:3200");
    }
}
